import store from '../../store'
import request from '../../utils/request';

const teacher = {
    state: {
        teachers: []
    },
    mutations: {
        SET_TEACHER: (state, teacherInfo) =>{
            state.teachers = teacherInfo
        }
    },
    actions: {
        getTeachers({ commit, state }) {
            return new Promise((resolve, reject) => {
                request({
                    url: "/user/findAllByParams",
                    method: "get",
                }).then(data => {   
                    commit('SET_TEACHER', data.data);
                    resolve(data);
                }).catch(err => {
                    reject(err)
                })
            })

        }
    }
}
export default teacher